import request from '../utils/request'

// 添加收货地址
export const addAddressRequest = (data) => {
  return request({
    method: 'post',
    url: '/member/address',
    data
  })
}

// 切换地址
export const choseAddressRequest = (data) => {
  return request({
    method: 'get',
    url: '/member/address',
    body: {
      ...data
    }
  })
}

// 初始页面
export const getOrderInfoRequest = () => {
  return request({
    method: 'get',
    url: '/member/order/pre'
  })
}

// 更新地址
export const updatedAddressRequest = (id, data) => {
  return request({
    method: 'put',
    url: `/member/address/${id}`,
    data
  })
}

// 提交订单
export const submitOrderRequest = (data) => {
  return request({
    method: 'post',
    url: '/member/order',
    data
  })
}
